<?php

namespace app\common\validate;

use think\Validate;

class Photo extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'    =>    ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'id' => 'require|number',
        'photo_id' => 'require|number',
        'img_id' => 'require|number',
        'photo_url' => 'min:1|max:250',
        'file_img_id' => 'require|number',
        'name' => 'require|max:100',
        'description' => 'min:1|max:250',
        'access_type' => 'require|in:0,1',
        'type' => 'require|in:1,2',
        'limit' => 'require|gt:0|number',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'    =>    '错误信息'
     *
     * @var array
     */
    protected $message = [];

    protected $scene = [
        //创建相册
        'create' => ['img_id', 'name', 'access_type', 'description'],
        //列表
        'list' => ['type', 'page', 'limit'],
        //相册前台列表
        'frontList' => [ 'page', 'limit'],
        //图片列表
        'imageList' => ['page', 'limit','id'],
        //删除相册
        'delete' => ['id'],
        //删除相册图片
        'deletePhotoImage' => ['photo_id','image_id'],
        //改变相册状态
        'changeLockStatus' => ['id']
    ];


}
